<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>kubebuilder环境搭建 | Lyra</title><meta name="author" content="lyra"><meta name="copyright" content="lyra"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="kubebuilder环境搭建 环境如下  go version v1.13+.  ( 使用版本：1.16.6)  docker version 17.03+.  (使用版本：20.10.7)  已安装 kubectl version v1.11.3+. (使用版本：1.21.10)  已安装 kustomize v3.1.0+ (使用版本：3.2.0)  Access to a Kubernet">
<meta property="og:type" content="article">
<meta property="og:title" content="kubebuilder环境搭建">
<meta property="og:url" content="https://gitee.com/Lyra3/blog/2023/08/15/kubebuilder%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/index.html">
<meta property="og:site_name" content="Lyra">
<meta property="og:description" content="kubebuilder环境搭建 环境如下  go version v1.13+.  ( 使用版本：1.16.6)  docker version 17.03+.  (使用版本：20.10.7)  已安装 kubectl version v1.11.3+. (使用版本：1.21.10)  已安装 kustomize v3.1.0+ (使用版本：3.2.0)  Access to a Kubernet">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://gitee.com/Lyra3/blog/img/avatar.png">
<meta property="article:published_time" content="2023-08-15T14:16:06.526Z">
<meta property="article:modified_time" content="2023-08-15T14:16:44.201Z">
<meta property="article:author" content="lyra">
<meta property="article:tag" content="应用部署">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/Lyra3/blog/img/avatar.png"><link rel="shortcut icon" href="/blog/img/favicon1.png"><link rel="canonical" href="https://gitee.com/Lyra3/blog/2023/08/15/kubebuilder%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/blog/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'kubebuilder环境搭建',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-08-15 22:16:44'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"><link rel="alternate" href="/blog/atom.xml" title="Lyra" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/blog/img/avatar.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/blog/archives/"><div class="headline">Articles</div><div class="length-num">4</div></a><a href="/blog/tags/"><div class="headline">Tags</div><div class="length-num">2</div></a><a href="/blog/categories/"><div class="headline">Categories</div><div class="length-num">4</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><span id="blog-info"><a href="/blog/" title="Lyra"><span class="site-name">Lyra</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">kubebuilder环境搭建</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2023-08-15T14:16:06.526Z" title="Created 2023-08-15 22:16:06">2023-08-15</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2023-08-15T14:16:44.201Z" title="Updated 2023-08-15 22:16:44">2023-08-15</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/k8s/">k8s</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/k8s/kubebuilder/">kubebuilder</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="kubebuilder环境搭建"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="kubebuilder环境搭建"><a href="#kubebuilder环境搭建" class="headerlink" title="kubebuilder环境搭建"></a>kubebuilder环境搭建</h1><blockquote>
<p>环境如下</p>
<ul>
<li><a target="_blank" rel="noopener" href="https://golang.org/dl/">go</a> version v1.13+.  ( 使用版本：1.16.6) </li>
<li><a target="_blank" rel="noopener" href="https://docs.docker.com/install/">docker</a> version 17.03+.  (使用版本：20.10.7)  已安装</li>
<li><a target="_blank" rel="noopener" href="https://kubernetes.io/docs/tasks/tools/install-kubectl/">kubectl</a> version v1.11.3+. (使用版本：1.21.10)  已安装</li>
<li><a target="_blank" rel="noopener" href="https://sigs.k8s.io/kustomize/docs/INSTALL.md">kustomize</a> v3.1.0+ (使用版本：3.2.0) </li>
<li>Access to a Kubernetes v1.11.3+ cluster. (使用版本：1.21.10)  已安装</li>
</ul>
</blockquote>
<h2 id="go环境安装"><a href="#go环境安装" class="headerlink" title="go环境安装"></a>go环境安装</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 下载go安装包</span></span><br><span class="line">wget https://studygolang.com/dl/golang/go1.16.6.linux-amd64.tar.gz</span><br><span class="line"></span><br><span class="line"><span class="comment"># 解压到指定目录</span></span><br><span class="line">tar -zxvf go1.16.6.linux-amd64.tar.gz -C /usr/local</span><br><span class="line"></span><br><span class="line"><span class="comment"># 配置环境变量 vi /etc/profile</span></span><br><span class="line"><span class="built_in">export</span> GOROOT=/usr/local/go</span><br><span class="line"><span class="built_in">export</span> GOPATH=/home/goProject</span><br><span class="line"></span><br><span class="line"><span class="comment"># 刷新环境变量</span></span><br><span class="line"><span class="built_in">source</span> /etc/profile</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看版本</span></span><br><span class="line">go version</span><br></pre></td></tr></table></figure>



<h2 id="kustomize环境安装"><a href="#kustomize环境安装" class="headerlink" title="kustomize环境安装"></a>kustomize环境安装</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 获取资源</span></span><br><span class="line">curl -Lo ./kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.2.0/kustomize_3.2.0_linux_amd64</span><br><span class="line"></span><br><span class="line"><span class="comment"># 修改权限</span></span><br><span class="line"><span class="built_in">chmod</span> +x ./kustomize</span><br><span class="line"></span><br><span class="line"><span class="comment"># 移动到bin目录下</span></span><br><span class="line">sudo <span class="built_in">mv</span> kustomize /usr/local/bin</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看版本</span></span><br><span class="line">kustomize version</span><br></pre></td></tr></table></figure>



<h2 id="kubebuilder环境安装"><a href="#kubebuilder环境安装" class="headerlink" title="kubebuilder环境安装"></a>kubebuilder环境安装</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 下载kubebuilder安装包 kubebuilder_2.3.1_linux_amd64.tar.gz</span></span><br><span class="line">https://github.com/kubernetes-sigs/kubebuilder/releases/v2.3.1 <span class="comment">#下载地址</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 解压</span></span><br><span class="line">tar -zxvf kubebuilder_2.3.1_linux_amd64.tar.gz</span><br><span class="line"></span><br><span class="line"><span class="comment"># 移动到bin目录下</span></span><br><span class="line">sudo <span class="built_in">mv</span> /kubebuilder_2.3.1_linux_amd64 /usr/local/kubebuilder</span><br><span class="line"></span><br><span class="line"><span class="comment"># 添加环境变量 vi /etc/profile</span></span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$PATH</span>:/usr/local/kubebuilder/bin</span><br><span class="line"></span><br><span class="line"><span class="comment"># kubebuilder依赖go module,所以要打开go module环境变量</span></span><br><span class="line"><span class="built_in">export</span> GO111MODULE=on</span><br><span class="line"><span class="built_in">export</span> GOPROXY=https://goproxy.io</span><br><span class="line"></span><br><span class="line"><span class="comment"># 刷新环境变量</span></span><br><span class="line"><span class="built_in">source</span> /etc/profile</span><br></pre></td></tr></table></figure>



<h2 id="创建项目验证"><a href="#创建项目验证" class="headerlink" title="创建项目验证"></a>创建项目验证</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 创建项目文件</span></span><br><span class="line"><span class="built_in">mkdir</span> <span class="variable">$GOPATH</span>/src/example</span><br><span class="line"><span class="built_in">cd</span> <span class="variable">$GOPATH</span>/src/example</span><br><span class="line"><span class="comment"># 初始化,此时会在$GOPATH生产pkg和bin文件,如果初始化时没有controller-gen会自动下载</span></span><br><span class="line">kubebuilder init --domain m </span><br><span class="line"></span><br><span class="line"><span class="comment"># 初始化成功</span></span><br><span class="line">--------------------------------</span><br><span class="line">[root@master example]<span class="comment"># kubebuilder init --domain m</span></span><br><span class="line">go get sigs.k8s.io/controller-runtime@v0.4.0</span><br><span class="line">go mod tidy</span><br><span class="line">Running make...</span><br><span class="line">make</span><br><span class="line"><span class="built_in">which</span>: no controller-gen <span class="keyword">in</span> (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/lib/golang/bin:/home/root/goproject/bin:/root/bin:/usr/lib/golang/bin:/home/root/goproject/bin::/usr/lib/golang/bin:/home/root/goproject/bin:/usr/local/kubebuilder/bin/:/usr/lib/golang/bin:/home/root/goproject/bin:/usr/local/kubebuilder/bin//bin:/usr/local/go/bin:/home/root/goproject/bin:/usr/local/kubebuilder/bin:/usr/local/go/bin:/home/root/goproject/bin:/usr/local/kubebuilder/bin:/usr/local/go/bin:/home/goproject/bin:/usr/local/kubebuilder/bin:/usr/local/go/bin:/home/goproject/bin:/usr/local/kubebuilder/bin)</span><br><span class="line">go: creating new go.mod: module tmp</span><br><span class="line">go: downloading sigs.k8s.io/controller-tools v0.2.4</span><br><span class="line">go: downloading github.com/spf13/cobra v0.0.5</span><br><span class="line">go: downloading github.com/gobuffalo/flect v0.1.5</span><br><span class="line">go: downloading golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac</span><br><span class="line">go: downloading github.com/fatih/color v1.7.0</span><br><span class="line">go: downloading gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966</span><br><span class="line">go: downloading github.com/inconshreveable/mousetrap v1.0.0</span><br><span class="line">go: downloading github.com/mattn/go-colorable v0.1.2</span><br><span class="line">go: downloading github.com/mattn/go-isatty v0.0.8</span><br><span class="line">go get: added sigs.k8s.io/controller-tools v0.2.4</span><br><span class="line">/home/goproject/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths=<span class="string">&quot;./...&quot;</span></span><br><span class="line">go <span class="built_in">fmt</span> ./...</span><br><span class="line">go vet ./...</span><br><span class="line">go build -o bin/manager main.go</span><br><span class="line">Next: Define a resource with:</span><br><span class="line">$ kubebuilder create api</span><br><span class="line">---------------------</span><br></pre></td></tr></table></figure>



<h3 id="测试工作"><a href="#测试工作" class="headerlink" title="测试工作"></a>测试工作</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># kubebuilder官方文档</span></span><br><span class="line">https://cloudnative.to/kubebuilder/quick-start.html</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装tree工具,可以查看目录结构</span></span><br><span class="line">yum install tree -y</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看初始化好的目录结构</span></span><br><span class="line">tree</span><br><span class="line">------------------</span><br><span class="line">[root@master example]<span class="comment"># tree</span></span><br><span class="line">.</span><br><span class="line">├── bin</span><br><span class="line">│   └── manager</span><br><span class="line">├── config</span><br><span class="line">│   ├── certmanager</span><br><span class="line">│   │   ├── certificate.yaml</span><br><span class="line">│   │   ├── kustomization.yaml</span><br><span class="line">│   │   └── kustomizeconfig.yaml</span><br><span class="line">│   ├── default</span><br><span class="line">│   │   ├── kustomization.yaml</span><br><span class="line">│   │   ├── manager_auth_proxy_patch.yaml</span><br><span class="line">│   │   ├── manager_webhook_patch.yaml</span><br><span class="line">│   │   └── webhookcainjection_patch.yaml</span><br><span class="line">│   ├── manager</span><br><span class="line">│   │   ├── kustomization.yaml</span><br><span class="line">│   │   └── manager.yaml</span><br><span class="line">│   ├── prometheus</span><br><span class="line">│   │   ├── kustomization.yaml</span><br><span class="line">│   │   └── monitor.yaml</span><br><span class="line">│   ├── rbac</span><br><span class="line">│   │   ├── auth_proxy_role_binding.yaml</span><br><span class="line">│   │   ├── auth_proxy_role.yaml</span><br><span class="line">│   │   ├── auth_proxy_service.yaml</span><br><span class="line">│   │   ├── kustomization.yaml</span><br><span class="line">│   │   ├── leader_election_role_binding.yaml</span><br><span class="line">│   │   ├── leader_election_role.yaml</span><br><span class="line">│   │   └── role_binding.yaml</span><br><span class="line">│   └── webhook</span><br><span class="line">│       ├── kustomization.yaml</span><br><span class="line">│       ├── kustomizeconfig.yaml</span><br><span class="line">│       └── service.yaml</span><br><span class="line">├── Dockerfile</span><br><span class="line">├── go.mod</span><br><span class="line">├── go.sum</span><br><span class="line">├── hack</span><br><span class="line">│   └── boilerplate.go.txt</span><br><span class="line">├── main.go</span><br><span class="line">├── Makefile</span><br><span class="line">└── PROJECT</span><br><span class="line">------------------</span><br><span class="line"></span><br></pre></td></tr></table></figure>

</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="https://gitee.com/Lyra3/blog">lyra</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="https://gitee.com/Lyra3/blog/2023/08/15/kubebuilder%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/">https://gitee.com/Lyra3/blog/2023/08/15/kubebuilder%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/blog/tags/%E5%BA%94%E7%94%A8%E9%83%A8%E7%BD%B2/">应用部署</a></div><div class="post_share"><div class="social-share" data-image="/blog/img/avatar.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/blog/2023/09/07/linux%E5%B8%B8%E7%94%A8/" title="linux 常用"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">linux 常用</div></div></a></div><div class="next-post pull-right"><a href="/blog/2023/08/14/mysql%E9%83%A8%E7%BD%B2/" title="mysql部署"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">Next Post</div><div class="next_info">mysql部署</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>Related Articles</span></div><div class="relatedPosts-list"><div><a href="/blog/2023/08/14/mysql%E9%83%A8%E7%BD%B2/" title="mysql部署"><div class="cover" style="background: var(--default-bg-color)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-08-14</div><div class="title">mysql部署</div></div></a></div><div><a href="/blog/2023/08/14/k8s%E9%83%A8%E7%BD%B2/" title="k8s部署"><div class="cover" style="background: var(--default-bg-color)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-08-14</div><div class="title">k8s部署</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/blog/img/avatar.png" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">lyra</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/blog/archives/"><div class="headline">Articles</div><div class="length-num">4</div></a><a href="/blog/tags/"><div class="headline">Tags</div><div class="length-num">2</div></a><a href="/blog/categories/"><div class="headline">Categories</div><div class="length-num">4</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/wwwviolet"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/wwwviolet" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:lqwwymail@163.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>Announcement</span></div><div class="announcement_content">share</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#kubebuilder%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA"><span class="toc-text">kubebuilder环境搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#go%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85"><span class="toc-text">go环境安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#kustomize%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85"><span class="toc-text">kustomize环境安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#kubebuilder%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85"><span class="toc-text">kubebuilder环境安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE%E9%AA%8C%E8%AF%81"><span class="toc-text">创建项目验证</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95%E5%B7%A5%E4%BD%9C"><span class="toc-text">测试工作</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/blog/2023/09/07/linux%E5%B8%B8%E7%94%A8/" title="linux 常用">linux 常用</a><time datetime="2023-09-06T22:42:27.000Z" title="Created 2023-09-07 06:42:27">2023-09-07</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/blog/2023/08/15/kubebuilder%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/" title="kubebuilder环境搭建">kubebuilder环境搭建</a><time datetime="2023-08-15T14:16:06.526Z" title="Created 2023-08-15 22:16:06">2023-08-15</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/blog/2023/08/14/mysql%E9%83%A8%E7%BD%B2/" title="mysql部署">mysql部署</a><time datetime="2023-08-14T15:32:43.794Z" title="Created 2023-08-14 23:32:43">2023-08-14</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/blog/2023/08/14/k8s%E9%83%A8%E7%BD%B2/" title="k8s部署">k8s部署</a><time datetime="2023-08-14T12:27:33.377Z" title="Created 2023-08-14 20:27:33">2023-08-14</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By lyra</div><div class="framework-info"><span>Framework </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>Theme </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="Back To Top"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/blog/js/utils.js"></script><script src="/blog/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>